<?php
/**
 * Created by PhpStorm.
 * User: skytop
 * Date: 2016/8/20
 * Time: 14:39
 */

namespace Admin\Model;


use Think\Model\RelationModel;

class UserRelationModel extends RelationModel
{
    protected $tableName='user';

    //定义关联关系
    protected $_link=array(
        'role'=>array(
            'mapping_type'=>self::MANY_TO_MANY,
            'foreign_key'=>'user_id',
            'relation_key'=>'role_id',
            'relation_table'=>'hd_role_user',
            'mapping_fields'=>'id,name,remark'
        )
    );
}